<%@ page import="cn.edu.hbcit.text1.StudentDb" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.edu.hbcit.text1.Student" %><%--
  Created by IntelliJ IDEA.
  User: 11507
  Date: 2019/6/20
  Time: 10:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>查询结果如下</title>
</head>
<body>
<div class="container">

    <%@include file="template/header.jsp" %>

    <h2>查找信息如下</h2>
    <p>您可以实现增删改查几个功能</p>
    <form class="form-inline">
        <input name="" class="form-control" type="text" placeholder="Search" id="search">
        <button class="btn btn-success" type="button">Search</button>
        <a href="student_main.jsp">
            <button class="btn btn btn-outline-primary" type="button">返回主页面</button>
        </a>
    </form>
    <table class="table table-striped">
        <thead>
        <tr>
            <th>学号</th>
            <th>姓名</th>
            <th>年龄</th>
            <th>性别</th>
            <th>班级</th>
            <th>民族</th>
            <th>籍贯</th>
            <th>专业</th>
        </tr>
        </thead>
        <tbody>
            <%
        ServletContext context =(ServletContext)request.getServletContext();
        String acountNumber = (String) context.getAttribute("acountNumber");
        String name = request.getParameter("sname");
        List<Student> list = StudentDb.selName(acountNumber,name);
        for (Student stu:list) {
        out.print("<tr>");
        out.print("<td>");
        out.print(stu.getStuId());
        out.print("</td>");
        out.print("<td>");
        out.print(stu.getStuMame());
        out.print("</td>");
        out.print("<td>");
        out.print(stu.getStuAge());
        out.print("</td>");
        out.print("<td>");
        out.print(stu.getStuSex());
        out.print("</td>");
        out.print("<td>");
        out.print(stu.getStuClass());
        out.print("</td>");
        out.print("<td>");
        out.print(stu.getStuNation());
        out.print("</td>");
        out.print("<td>");
        out.print(stu.getStuNativePlace());
        out.print("</td>");
        out.print("<td>");
        out.print(stu.getStuMajor());
        out.print("</td>");
        out.print("<td>");
        out.print("</tr>");
      }
    %>
        <%@include file="template/footer.jsp" %>
</div>
<%@include file="template/link.jsp" %>


<script>
    function getSearchValue() {
        var inputValue = document.getElementById('search').value;
        alert(inputValue);
        document.getElementById('search').name = inputValue;
    }

</script>
</body>
</html>
